package com.wisnews.util;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.wisnews.pojo.sr.entity.Member;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description：
 * @Author: yuyd
 * @Email: yyd8358@foxmail.com
 * @Date: 2021/3/21 14:13
 * @Version 1.0
 */
public class MemberUtils {

    /**
     * @description: 获取登录用户信息
     * @param:
     * @return:
     * @author yuyd
     * @date: 2021/5/3 15:26
     */
    public static Member getLoginUserInfo(HttpServletRequest request) {
        Object member = request.getSession().getAttribute("member");
        if (ObjectUtils.isNull(member) || !(member instanceof Member)){
           return null;
        }
        return  (Member) member;
    }
}
